package com.briup.recognition.service.impl;

import com.briup.recognition.bean.BaseFile;
import com.briup.recognition.bean.BaseFileExample;
import com.briup.recognition.bean.Greenhouse;
import com.briup.recognition.bean.GreenhouseExample;
import com.briup.recognition.dao.BaseFileMapper;
import com.briup.recognition.dao.GreenhouseMapper;
import com.briup.recognition.service.IBaseFileService;
import com.briup.recognition.service.IGreenhouseService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: recognition
 * @description:
 * @author: charles
 * @create: 2021-03-28 15:11
 **/

@Service
public class BaseFileServiceImpl implements IBaseFileService {

    @Resource
    private BaseFileMapper baseFileMapper;

    @Override
    public List<BaseFile> query() {
        BaseFileExample example = new BaseFileExample();
        // 条件

        return baseFileMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(BaseFile BaseFile) {
        if(BaseFile.getId()!=null){
            baseFileMapper.updateByPrimaryKey(BaseFile);
        } else {
            baseFileMapper.insert(BaseFile);
        }
    }

    @Override
    public void deleteById(long id) {
        baseFileMapper.deleteByPrimaryKey(id+"");
    }
}
